'\" t
.TH "SYSTEMD\-ASK\-PASSWORD" "1" "" "systemd 249" "systemd-ask-password"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
systemd-ask-password \- Query the user for a system password
.SH "SYNOPSIS"
.HP \w'\fBsystemd\-ask\-password\ \fR\fB[OPTIONS...]\fR\fB\ \fR\fB[MESSAGE]\fR\ 'u
\fBsystemd\-ask\-password \fR\fB[OPTIONS...]\fR\fB \fR\fB[MESSAGE]\fR
.SH "DESCRIPTION"
.PP
\fBsystemd\-ask\-password\fR
may be used to query a system password or passphrase from the user, using a question message specified on the command line\&. When run from a TTY it will query a password on the TTY and print it to standard output\&. When run with no TTY or with
\fB\-\-no\-tty\fR
it will use the system\-wide query mechanism, which allows active users to respond via several agents, listed below\&.
.PP
The purpose of this tool is to query system\-wide passwords \(em that is passwords not attached to a specific user account\&. Examples include: unlocking encrypted hard disks when they are plugged in or at boot, entering an SSL certificate passphrase for web and VPN servers\&.
.PP
Existing agents are:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
A boot\-time password agent asking the user for passwords using
\fBplymouth\fR(8),
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
A boot\-time password agent querying the user directly on the console \(em
\fBsystemd-ask-password-console.service\fR(8),
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
An agent requesting password input via a
\fBwall\fR(1)
message \(em
\fBsystemd-ask-password-wall.service\fR(8),
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
A TTY agent that is temporarily spawned during
\fBsystemctl\fR(1)
invocations,
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
A command line agent which can be started temporarily to process queued password requests \(em
\fBsystemd\-tty\-ask\-password\-agent \-\-query\fR\&.
.RE
.PP
Answering system\-wide password queries is a privileged operation, hence all the agents listed above (except for the last one), run as privileged system services\&. The last one also needs elevated privileges, so should be run through
\fBsudo\fR(8)
or similar\&.
.PP
Additional password agents may be implemented according to the
\m[blue]\fBsystemd Password Agent Specification\fR\m[]\&\s-2\u[1]\d\s+2\&.
.PP
If a password is queried on a TTY, the user may press TAB to hide the asterisks normally shown for each character typed\&. Pressing Backspace as first key achieves the same effect\&.
.SH "OPTIONS"
.PP
The following options are understood:
.PP
\fB\-\-icon=\fR
.RS 4
Specify an icon name alongside the password query, which may be used in all agents supporting graphical display\&. The icon name should follow the
\m[blue]\fBXDG Icon Naming Specification\fR\m[]\&\s-2\u[2]\d\s+2\&.
.RE
.PP
\fB\-\-id=\fR
.RS 4
Specify an identifier for this password query\&. This identifier is freely choosable and allows recognition of queries by involved agents\&. It should include the subsystem doing the query and the specific object the query is done for\&. Example:
"\-\-id=cryptsetup:/dev/sda5"\&.
.RE
.PP
\fB\-\-keyname=\fR
.RS 4
Configure a kernel keyring key name to use as cache for the password\&. If set, then the tool will try to push any collected passwords into the kernel keyring of the root user, as a key of the specified name\&. If combined with
\fB\-\-accept\-cached\fR, it will also try to retrieve such cached passwords from the key in the kernel keyring instead of querying the user right away\&. By using this option, the kernel keyring may be used as effective cache to avoid repeatedly asking users for passwords, if there are multiple objects that may be unlocked with the same password\&. The cached key will have a timeout of 2\&.5min set, after which it will be purged from the kernel keyring\&. Note that it is possible to cache multiple passwords under the same keyname, in which case they will be stored as
\fBNUL\fR\-separated list of passwords\&. Use
\fBkeyctl\fR(1)
to access the cached key via the kernel keyring directly\&. Example:
"\-\-keyname=cryptsetup"
.RE
.PP
\fB\-\-credential=\fR
.RS 4
Configure a credential to read the password from \(en if it exists\&. This may be used in conjunction with the
\fILoadCredential=\fR
and
\fISetCredential=\fR
settings in unit files\&. See
\fBsystemd.exec\fR(5)
for details\&. If not specified, defaults to
"password"\&. This option has no effect if no credentials directory is passed to the program (i\&.e\&.
\fI$CREDENTIALS_DIRECTORY\fR
is not set) or if the no credential of the specified name exists\&.
.RE
.PP
\fB\-\-timeout=\fR
.RS 4
Specify the query timeout in seconds\&. Defaults to 90s\&. A timeout of 0 waits indefinitely\&.
.RE
.PP
\fB\-\-echo=yes|no|masked\fR
.RS 4
Controls whether to echo user input\&. Takes a boolean or the special string
"masked", the default being the latter\&. If enabled the typed characters are echoed literally, which is useful for prompting for usernames and other non\-protected data\&. If disabled the typed characters are not echoed in any form, the user will not get feedback on their input\&. If set to
"masked", an asterisk ("*") is echoed for each character typed\&. In this mode, if the user hits the tabulator key ("↹"), echo is turned off\&. (Alternatively, if the user hits the backspace key ("⌫") while no data has been entered otherwise, echo is turned off, too)\&.
.RE
.PP
\fB\-\-echo\fR, \fB\-e\fR
.RS 4
Equivalent to
\fB\-\-echo=yes\fR, see above\&.
.RE
.PP
\fB\-\-emoji=yes|no|auto\fR
.RS 4
Controls whether or not to prefix the query with a lock and key emoji (🔐), if the TTY settings permit this\&. The default is
"auto", which defaults to
"yes", unless
\fB\-\-echo=yes\fR
is given\&.
.RE
.PP
\fB\-\-no\-tty\fR
.RS 4
Never ask for password on current TTY even if one is available\&. Always use agent system\&.
.RE
.PP
\fB\-\-accept\-cached\fR
.RS 4
If passed, accept cached passwords, i\&.e\&. passwords previously entered\&.
.RE
.PP
\fB\-\-multiple\fR
.RS 4
When used in conjunction with
\fB\-\-accept\-cached\fR
accept multiple passwords\&. This will output one password per line\&.
.RE
.PP
\fB\-\-no\-output\fR
.RS 4
Do not print passwords to standard output\&. This is useful if you want to store a password in kernel keyring with
\fB\-\-keyname=\fR
but do not want it to show up on screen or in logs\&.
.RE
.PP
\fB\-n\fR
.RS 4
By default, when writing the acquired password to standard output it is suffixed by a newline character\&. This may be turned off with the
\fB\-n\fR
switch, similar to the switch of the same name of the
\fBecho\fR(1)
command\&.
.RE
.PP
\fB\-h\fR, \fB\-\-help\fR
.RS 4
Print a short help text and exit\&.
.RE
.SH "EXIT STATUS"
.PP
On success, 0 is returned, a non\-zero failure code otherwise\&.
.SH "SEE ALSO"
.PP
\fBsystemd\fR(1),
\fBsystemd-ask-password-console.service\fR(8),
\fBsystemd-tty-ask-password-agent\fR(1),
\fBkeyctl\fR(1),
\fBplymouth\fR(8),
\fBwall\fR(1)
.SH "NOTES"
.IP " 1." 4
systemd Password Agent Specification
.RS 4
\%https://systemd.io/PASSWORD_AGENTS/
.RE
.IP " 2." 4
XDG Icon Naming Specification
.RS 4
\%http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html
.RE
